#include "calc.h"

#include "resolver.h"
#include "default.h"
#include "cache.h"
extern Cache CACHE;

Calc::Calc()
{
	value_ = Value( 0 );
}

Calc::Calc( string f_string )
{
	execute( f_string );
}

Calc::~Calc()
{
}

Value* Calc::value()
{
	return &value_;
}

#include <iostream>
void Calc::execute( string f_string )
{
	int32 f_find = f_string.find( " " );
	while( f_find != -1 )
	{
		f_string.erase( f_find, 1 );
		f_find = f_string.find( " " );
	}

	value_ = CACHE.get( Resolver::resolve( f_string ) );
	CACHE.clear();
}
